<%@ page language="java" import="java.util.*,com.ruohi.util.common.*" pageEncoding="UTF-8"%><%
	String tablePrefix = Env.getInstance().getProperty("table_prefix");
	String tableName = "gift_customize_index_category";
	String channelUUID = CommonString.getFormatPara(request.getParameter("channel_uuid"));
	String fileds = "id,uuid,cus_category,order_no,left_product_no,left_product_img,(select name from gift_customize_product where gift_customize_product.no=gift_customize_index_category.left_product_no) as left_product_name";
	String whereStr = "";
	String orderByStr = " order_no desc ";
	
	//定制类别
	Map cus_category_map = CommonApplication.getEnumChildren("197", application);
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title><%=Env.getInstance().getProperty("project_name") %></title>
	<link href="/plugin/ui/ligerUI/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
	<link href="/plugin/ui/ligerUI/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
	<link href="/plugin/ui/ligerUI/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
	<link href="/backend/style/style.css" rel="stylesheet" type="text/css" />
	<script src="/plugin/jquery/jquery.min.js" type="text/javascript"></script>
  </head>
  <body>
  	<div class="searchForm">
  		<div class="searchCondition">
	  		<div class="searchLeft">定制类别</div>
	  		<div class="searchRight">
	  			<select class="jr_select" id="cus_category" name="cus_category">
                    <option value="">--请选择--</option>
                    <%=CommonForm.createSelect(cus_category_map, "") %>
                </select>
	  		</div>
  		</div>
  		<div class="searchBtn">
  			<input type="button" class="btn" onclick="doSearch();" value="查询" />
  			<input type="button" class="btn" onclick="doClearForm();" value="重置" />
  		</div>
  	</div>
	<div style="clear: left;"></div>
	<div class="l-loading" style="display: block" id="pageloading"></div> 
	<div id="maingrid" style="margin: 0; padding: 0"></div>
	<div style="display: none;"></div>
  </body>
</html>
<script src="/plugin/ui/ligerUI/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="/backend/scripts/common.js" prefix="<%=tablePrefix %>" type="text/javascript"></script>
<script type="text/javascript">
	var grid;
	var tableName = "<%=tableName %>";
	var channelUUID = '<%=channelUUID%>';
	var fields = "<%=fileds %>";
	var whereStr = "<%=whereStr %>";
	var orderBy = "<%=orderByStr %>";
	var columnsArr = [];
	var url = "";
	var conditionStr = "";
	var params = [];
	jQuery(function() {
		params.push({'name':'enumNo','value':'106013','fileName':'test'});
		grid = new Dev21sunGrid();
		jQuery("#pageloading").hide();
	});
	//列数组
	columnsArr =  [ 
	{ display:"定制类别", name:"cus_category", align:"center", type:"string", width:100, render:function(row){
		return getEnum(row.cus_category);
	} },
	{ display:"排序号", name:"order_no", align:"center", type:"string", width:120 },
	{ display:"左侧产品", name:"left_product_name", align:"center", type:"string", width:200 },
	{ display:"操作", align:"center", width:"80", render:function(row){
		return "<a href='javascript://void(0);' onclick='addAndEdit(" + row.__index + ");'>编辑</a>";
	} }
	];
	
	function addAndEdit(index){
		if(undefined==index){//如果是增加
			toolbarAdd({
				width:700,
				height:330,
				title:"增加",
				folderName:"gift.21-sun.com/gift_customize/gift_customize_index",
				fileName:"index_category",
				params : {
	    			channel_uuid : "<%=channelUUID %>"
	    		}
			});
		}else{//如果是修改
	    	var row = grid.getRow(index);
	    	toolbarAdd({
	    		width:700,
	    		height:330,
	    		folderName:"gift.21-sun.com/gift_customize/gift_customize_index",
				fileName:"index_category",
	    		title:'编辑'
	    	},row.uuid);
		}
    }
	/*列表页条件查询*/
	function doSearch(){
		params = [];
		conditionStr = "";
		var cus_category = $.trim($("#cus_category").val());
		if(cus_category != ""){
			conditionStr += " and cus_category='" + cus_category + "'";
		}
		params.push({'name':'tableName','value':tableName});
		params.push({'name':'enumNo','value':'106013'});
		params.push({'name':'fields','value':fields});
		params.push({'name':'whereStr','value':conditionStr});
		params.push({'name':'orderBy','value':orderBy});
		grid.options.parms=params;
		grid.loadData();
	}
</script>